Why ? 

Tagging plays is useful to run a specific play(s) and skip others when these plays are inside the same file (same playbook)



What ?

Tags are an attribute of play like other attributes (hosts,  tasks, gather_facts, become, ...).

Tags can be a simple string or list of string. Each string is a tag.


How ? 

This is an example of a playbook with two tagged plays :


# first play
- name: play one
  hosts: localhost
  gather_facts: no
  tags:
  - play-one
  tasks:
  - name: task from first play
    debug:
      msg: "I am task from first play"

# second play
- name: play two
  hosts: localhost
  gather_facts: no
  tags:
  - play-two
  tasks:
  - name: task from second play
    debug:
      msg: "I am task from second play"


- To Run only first play, you need to run the command as following: 

ansible-playbook  file.yaml --tags play-one

- To Run only second play, you need to run the command as following: 

ansible-playbook  file.yaml --tags play-two

- To run both, omit tags as ansible-playbook runs all plays in no tags is specified.

Or, run this command : ansible-playbook  file.yaml --tags play-one,play-two

Where you put comma (,) as separator among tags.